import { createRouter, createWebHistory } from 'vue-router'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: "/index"
    },
    {
      path: '/index',
      name: 'index',
      // 重定向到首页
      redirect: "/intelligence",
      // 路由元信息
      meta: {
        title: "主页"
      },
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/Index/index.vue'),

      // 子路由
      children: [
        //  首页  ---  智能检测
        {
          path: "/intelligence",
          name: "intelligence",
          meta: {
            name: "智能检测"
          },
          component: () => import("../views/Intelligence/index.vue")
        },
        // 就业趋势
        {
          path: "/employment",
          name: "employment",
          meta: {
            name: "就业趋势"
          },
          component: () => import("../views/Employment/index.vue")
        },

        // 安防管理
        {
          path: "/safemanage",
          name: "safemanage",
          meta: {
            name: "安防管理",
            // 缓存
            keepAlive: true,
          },
          component: () => import("../views/Safemanage/index.vue")
        },
        // 设备运维
        {
          path: "/equipment",
          name: "equipment",
          meta: {
            name: "设备运维"
          },
          component: () => import("../views/Equipment/index.vue")
        }
      ]
    }
  ]
})

export default router
